12 / 17

What is the use of autocomplete?

Using the autocomplete Attribute in HTML

The autocomplete attribute in HTML is used to control whether a browser should automatically fill in input values based on previously entered data. It improves user experience by reducing the need to re-type common information like names, emails, and addresses.

Key Points About autocomplete
  1. 1

    Can be applied to <form> and individual <input> elements.

  2. 2

    Values: on (enable suggestions) or off (disable suggestions).

  3. 3

    Helps speed up form filling by suggesting previously entered values.

  4. 4

    Useful for fields like name, email, address, credit card info, etc.

Example of autocomplete Usage
Difficulty: 4/10
Topics: autocomplete attribute, form usability, privacy/security

Scenario Questions

0-2 years experience
  1. 1

    How would you enable browser autocomplete for the email input on a login page using plain HTML?

  2. 2

    If you leave the autocomplete attribute out of a password field, what behavior will the browser exhibit?

2-5 years experience
  1. 1

    Our registration form’s address fields aren’t being autofilled in Chrome. Walk me through how you’d investigate and fix the issue.

  2. 2

    Why might you set autocomplete='off' on a credit‑card number field even though it would speed up checkout for users?

  3. 3

    We need to support older browsers that ignore the autocomplete attribute. How would you provide a graceful fallback for those users?

5-8 years experience
  1. 1

    Design a strategy for handling autocomplete data across several micro‑services that collect user profile information, keeping GDPR privacy requirements in mind.

  2. 2

    What steps would you take to mitigate security risks when enabling autocomplete for sensitive fields on a large e‑commerce site?

  3. 3

    Discuss the trade‑offs between user experience and data protection when deciding which form fields should allow autocomplete globally.

8+ years experience
  1. 1

    Our legacy codebase is being migrated to a new component library. How would you establish a policy and tooling to ensure consistent use of autocomplete attributes across all teams?

  2. 2

    What architectural changes would you propose to centralize management of autocomplete values so we stay compliant with privacy regulations while preserving a seamless user experience?

Follow-up Questions

  • Can you give an example of a field where you would deliberately turn autocomplete off?
  • How does autocomplete interact with password managers?
  • What impact does autocomplete have on mobile form completion?